package executable.instance;

import ctu.kfad.run.memory.FieldValueConverter;
import ctu.kfad.run.memory.MemoryManager;

public class ClassWith10IntegerSize {

    private int value1;
    private int value2;
    private int value3;
    private int value4;
    private int value5;
    private int value6;
    private int value7;
    private int value8;
    private int value9;
    private int value10;

    private static void fillAlmostMemory() {
        final int count = MemoryManager.MEMORY_SIZE / (10 * FieldValueConverter.INT_BYTE_SIZE) - 100;      //100 is function of count :)
        ClassWith10IntegerSize[] array = new ClassWith10IntegerSize[count];
        for (int i = 0; i < count; i++) {
            array[i] = new ClassWith10IntegerSize();
        }
    }

    private static void fillMemory() {
        final int count = MemoryManager.MEMORY_SIZE / (10 * FieldValueConverter.INT_BYTE_SIZE) + 1;
        ClassWith10IntegerSize[] array = new ClassWith10IntegerSize[count];
        for (int i = 0; i < count; i++) {
            array[i] = new ClassWith10IntegerSize();
        }
    }

    private static void fillMemoryInMoreMethods() {
        for (int i = 0; i < 100; i++) {
            createALotObjects();
        }
    }

    private static void createALotObjects() {
        final int count = MemoryManager.MEMORY_SIZE / (100 * FieldValueConverter.INT_BYTE_SIZE);
        ClassWith10IntegerSize[] array = new ClassWith10IntegerSize[count];
        for (int i = 0; i < count; i++) {
            array[i] = new ClassWith10IntegerSize();
        }
    }


}
